package com.rs.game.player.dialogues.impl;

import com.rs.game.player.dialogues.Dialogue;
import com.rs.utils.Utils;

public class FatherAereck extends Dialogue {

    private int npcId;

    @Override
    public void start() {
	npcId = (Integer) parameters[0];
	sendNPCDialogue(npcId, 9827, "Hello there brother " + Utils.formatPlayerNameForDisplay(player.getDisplayName()) + ". How may I help you today?");
    }

    @Override
    public void run(int interfaceId, int componentId) {
	if (stage == -1) {
	    stage = 0;
	    sendOptionsDialogue(DEFAULT_OPTIONS_TITLE, "Could you change my prayerbook?", "Can you restore my prayer?", "Nothing, nevermind.");
	} else if (stage == 0) {
	    if (componentId == OPTION_1) {
		stage = 3;
		sendPlayerDialogue(9827, "Could you change my prayerbook?");
	    } else if (componentId == OPTION_2) {
		sendPlayerDialogue(9827, "Can you restore my prayer?");
		stage = 2;
	    } else if (componentId == OPTION_3) {
	    stage = 5;
	    sendPlayerDialogue(9827, "Never mind.");
	    }
	} else if (stage == 1) {
	    stage = 4;
	    sendNPCDialogue(npcId, 9827, "Of course you can. Have a look at this selection of gravestones.");
	} else if (stage == 2) {
	    stage = 5;
	    sendNPCDialogue(npcId, 9827, "I think the Gods prefer it if you pray<br>to them at an altar dedicated to their name.");
	} else if (stage == 4) {
	    end();
	} else if (stage == 3) {
	    stage = 6;
		if (!player.getPrayer().isAncientCurses())
			sendOptionsDialogue("Change from prayers to curses?",
					"Yes, replace my prayers with curses.", "Never mind.");
		else
			sendOptionsDialogue("Change from curses to prayers?",
					"Yes, replace my curses with prayers.", "Never mind.");
	} else if (stage == 5) {
		end();
	} else if (stage == 6) {
		if (componentId == OPTION_1) {
			if (!player.getPrayer().isAncientCurses()) {
				sendDialogue(
						"The altar fills your head with dark thoughts, purging the",
						"prayers from your memory and leaving only curses in",
						" their place.");
				player.getPrayer().setPrayerBook(true);
			} else {
				sendDialogue(
						"The altar eases its grip on your mid. The curses slip from",
						"your memory and you recall the prayers you used to know.");
				player.getPrayer().setPrayerBook(false);
			}
		} else
			end();
	}
    }

    @Override
    public void finish() {

    }
}
